package edu.scut.yi.yx.processer;

import com.electrotank.electroserver5.extensions.api.PluginApi;
import com.electrotank.electroserver5.extensions.api.value.EsObject;
import com.electrotank.electroserver5.extensions.api.value.EsObjectRO;

import edu.scut.yi.yx.gamemanager.GameList;
import edu.scut.yi.yx.lobbymanager.Command;

public class GetGameListProcesser extends AbstractProcesser{

	private EsObject gamelistResponse;
	
	
	@Override
	public String getCommand() {
		// TODO Auto-generated method stub
		return Command.LoadGames.getCode();
	}

	@Override
	public void process(String user, EsObjectRO message, PluginApi api) {
		gamelistResponse = new EsObject();
		gamelistResponse.setStringArray(Command.Message.getCode(), GameList.GAMELIST);
		gamelistResponse.setString(Command.Action.getCode(), Command.LoadGames.getCode());
		
		api.sendPluginMessageToUser(user, gamelistResponse);
		
	}

}
